/*
 * @Author: chengjiang
 * @Date: 2024-10-31 11:50:19
 * @Description: 
 */
import { TOKEN_KEY } from '../enums/global';

// sessionStorage
const getTokenStorage = () => (localStorage);

export function getToken() {
  return getTokenStorage().getItem(TOKEN_KEY);
}
(window as any).$getToken = getToken;

export function setToken(token?: string) {
  if (token) {
    return getTokenStorage().setItem(TOKEN_KEY, token);
  } else {
    return getTokenStorage().removeItem(TOKEN_KEY);
  }
}